package com.glx.learn_spring.learn_spring_01_quickstart;

import com.glx.learn_spring.learn_spring_01_quickstart.dao.IBookDao;
import com.glx.learn_spring.learn_spring_01_quickstart.dao.impl.BookDaoImpl;
import com.glx.learn_spring.learn_spring_01_quickstart.service.IBookService;
import com.glx.learn_spring.learn_spring_01_quickstart.service.impl.BookServiceImpl;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App2 {
    public static void main(String[] args) {
        // 加载配置文件获取上下文对象 也就是 Ioc容器对象
        ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");

        // 获取bean
        //IBookDao bookDao = ctx.getBean("bookDao",IBookDao.class);
        //bookDao.save();

        // 获取 bean
        IBookService bookService = ctx.getBean("bookService", IBookService.class);
        bookService.save();
    }
}
